package com.atguigu.lease.common.exception;

import com.atguigu.lease.common.result.ResultCodeEnum;
import lombok.Data;

/**
 * @Package: com.atguigu.lease.common.exception
 * @ClassName: LeaseException
 * @Author luu
 * @create 2024/10/4 11:24
 * @Description:
 */

@Data
public class LeaseException extends RuntimeException{

    // 异常状态码 枚举
    private ResultCodeEnum resultCodeEnum;

    //根据错误信息 创建异常对象
    public LeaseException(String message) {
        super(message);
    }

    //根据响应结果枚举对象创建异常对象
    public LeaseException(ResultCodeEnum resultCodeEnum) {
        super(resultCodeEnum.getMessage());
        this.resultCodeEnum = resultCodeEnum;
    }
}
